package com.wushijia.highconcurrency.thread;

import java.util.concurrent.TimeUnit;

public class Test {

  private static volatile boolean stop = false;

  public static void main(String[] args) throws Exception {
    Thread t = new Thread(new Runnable() {
      @Override
      public void run() {
        int i = 0;
        while (!stop) {
          i++;
//                    System.out.println("hello");
        }
      }
    });
    t.start();

    Thread.sleep(1000);
    TimeUnit.SECONDS.sleep(1);
    System.out.println("Stop Thread");
    stop = true;
  }
}
